import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { cameraDefenseTaskVO, cameraDefenseTaskForm, cameraDefenseTaskQuery } from '@/api/camera/camera-defense-task/types';

/**
 * 查询布防任务列表
 * @param query
 * @returns {*}
 */

export const listcameraDefenseTask = (query?: cameraDefenseTaskQuery): AxiosPromise<cameraDefenseTaskVO[]> => {
  return request({
    url: '/camera/camera-defense-task/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询布防任务详细
 * @param cameraDefenseTaskId
 */
export const getcameraDefenseTask = (cameraDefenseTaskId: string | number): AxiosPromise<cameraDefenseTaskVO> => {
  return request({
    url: '/camera/camera-defense-task/' + cameraDefenseTaskId,
    method: 'get'
  });
};

/**
 * 新增布防任务
 * @param data
 */
export const addcameraDefenseTask = (data: cameraDefenseTaskForm) => {
  return request({
    url: '/camera/camera-defense-task',
    method: 'post',
    data: data
  });
};

/**
 * 修改布防任务
 * @param data
 */
export const updatecameraDefenseTask = (data: cameraDefenseTaskForm) => {
  return request({
    url: '/camera/camera-defense-task',
    method: 'put',
    data: data
  });
};

/**
 * 删除布防任务
 * @param cameraDefenseTaskId
 */
export const delcameraDefenseTask = (cameraDefenseTaskId: string | number | Array<string | number>) => {
  return request({
    url: '/camera/camera-defense-task/' + cameraDefenseTaskId,
    method: 'delete'
  });
};
